package org.neuedu.chapter05_0618;

public class MethodDemo03 {
    public static void main(String[] args) {
        int a = 10;
        int b = 30;
        test1(a,b);// 实际参数
        test2("tom",66);
        test3(1999);
        int[] arr = {1, 2, 4, 6, 7, 89};
        test4(arr);
        test5(arr);
    }

    public static void test5(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[i] < arr[j]) {
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
    }

    public static void test4(int[] arr) {
        for (int i : arr) {
            System.out.println(i);
        }
    }

    public static void test1(int c,int d){ // 形式参数
        System.out.println(c + d);
    }

    public static void test2(String name,int age) {
        System.out.println(name+" 今年 "+age+" 岁");
    }

    public static void test3(int year) {
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            System.out.println("闰年");
        }else{
            System.out.println("平年");
        }
    }
}
